<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:r2ml="http://www.rewerse.net/I1/2006/R2ML" xmlns:soap="http://www.w3.org/2001/12/soap-envelope" targetNamespace="http://www.rewerse.net/I1/2006/R2ML" elementFormDefault="qualified" attributeFormDefault="qualified" version="0.4" xml:lang="en">
 <xs:import namespace="http://www.w3.org/2001/12/soap-envelope" schemaLocation="http://www.w3.org/2001/12/soap-envelope"/>
 <!-- 

Elements for events 

-->
 <xs:element name="SOAPMessageExpression" type="r2ml:SOAPMessageExpression" abstract="false" substitutionGroup="r2ml:MessageEventExpression"/>
 <xs:element name="MessageEventExpression" type="r2ml:MessageEventExpression" abstract="false" substitutionGroup="r2ml:AtomicEventExpression"/>
 <xs:element name="AtomicEventExpression" type="r2ml:AtomicEventExpression" abstract="false" substitutionGroup="r2ml:EventExpression"/>
 <xs:element name="AndNotEventExpression" type="r2ml:AndNotEventExpression" abstract="false" substitutionGroup="r2ml:EventExpression"/>
 <xs:element name="SequenceEventExpression" type="r2ml:SequenceEventExpression" abstract="false" substitutionGroup="r2ml:EventExpression"/>
 <xs:element name="ParallelEventExpression" type="r2ml:ParallelEventExpression" abstract="false" substitutionGroup="r2ml:EventExpression"/>
 <xs:element name="ChoiceEventExpression" type="r2ml:ChoiceEventExpression" abstract="false" substitutionGroup="r2ml:EventExpression"/>
 <xs:element name="EventExpression" type="r2ml:EventExpression" abstract="true"/>
 <!-- Event Expression -->
 <xs:complexType name="EventExpression" abstract="true">
 <!--
  <xs:attribute name="startTime" type="xs:dateTime" use="required"/>
  <xs:attribute name="duration" type="xs:duration" use="required"/>
  <xs:attribute name="occurTime" type="xs:dateTime" use="optional"/>
-->
 </xs:complexType>
 <!-- Atomic event expression -->
 <xs:complexType name="AtomicEventExpression" abstract="false">
  <xs:complexContent>
   <xs:extension base="r2ml:EventExpression">
    <xs:choice>
     <xs:element ref="r2ml:ObjectVariable" minOccurs="0" maxOccurs="1"/>
     <xs:element ref="r2ml:Slot" minOccurs="0"/>
    </xs:choice>
    <xs:attribute ref="r2ml:eventID" use="optional"/>
    <xs:attribute ref="r2ml:eventType" use="required"/>
   </xs:extension>
  </xs:complexContent>
 </xs:complexType>
 <!-- AndNotEventExpression -->
 <xs:complexType name="AndNotEventExpression" abstract="false">
  <xs:complexContent>
   <xs:extension base="r2ml:EventExpression">
    <xs:sequence>
     <xs:element ref="r2ml:EventExpression" minOccurs="2" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute name="timeWindow" type="xs:duration" use="required"/>
   </xs:extension>
  </xs:complexContent>
 </xs:complexType>
 <!-- SequenceEventExpression -->
 <xs:complexType name="SequenceEventExpression" abstract="false">
  <xs:complexContent>
   <xs:extension base="r2ml:EventExpression">
    <xs:sequence>
     <xs:element ref="r2ml:EventExpression" minOccurs="2" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute name="timeWindow" type="xs:duration" use="required"/>
   </xs:extension>
  </xs:complexContent>
 </xs:complexType>
 <!-- ParallelEventExpression -->
 <xs:complexType name="ParallelEventExpression" abstract="false">
  <xs:complexContent>
   <xs:extension base="r2ml:EventExpression">
    <xs:sequence>
     <xs:element ref="r2ml:EventExpression" minOccurs="2" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute name="timeWindow" type="xs:duration" use="required"/>
   </xs:extension>
  </xs:complexContent>
 </xs:complexType>
 <!-- ChoiceEventExpression -->
 <xs:complexType name="ChoiceEventExpression" abstract="false">
  <xs:complexContent>
   <xs:extension base="r2ml:EventExpression">
    <xs:sequence>
     <xs:element ref="r2ml:EventExpression" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute name="minOccurs" type="xs:nonNegativeInteger"/>
    <xs:attribute name="maxOccurs" type="xs:nonNegativeInteger"/>
   </xs:extension>
  </xs:complexContent>
 </xs:complexType>
 <!-- MessageEventExpression -->
 <xs:complexType name="MessageEventExpression" abstract="false">
  <xs:complexContent>
   <xs:extension base="r2ml:AtomicEventExpression">
    <xs:attribute ref="r2ml:sender" use="required"/>
   </xs:extension>
  </xs:complexContent>
 </xs:complexType>
 <!-- SOAPMessage -->
 <xs:complexType name="SOAPMessageExpression" abstract="false">
  <xs:complexContent>
   <xs:extension base="r2ml:MessageEventExpression">
    <xs:sequence>
     <xs:element ref="soap:Envelope"/>
    </xs:sequence>
   </xs:extension>
  </xs:complexContent>
 </xs:complexType>
</xs:schema>
